package com.lintesis.lintesisview.webgui.protocolo.metodo;

import org.zkoss.zkplus.databind.BindingListModel;
import org.zkoss.zkplus.databind.BindingListModelList;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Textbox;

import com.lintesis.lintesismodel.common.Type;
import com.lintesis.lintesismodel.common.hibernate.GenericDAO;
import com.lintesis.lintesismodel.protocolo.Metodo;
import com.lintesis.lintesisview.common.ABMDialogCtrl;
import com.lintesis.lintesisview.common.menu.UserWorkspace;

public class MetodoDialogCtrl extends ABMDialogCtrl<Metodo> {

	private static final long serialVersionUID = 5715943166406222067L;

	static final String rightPreffix = "metodo.dialog.";
	
	Textbox tbNombre;
	Combobox cbTipoMuestra;
	
	BindingListModel lmTiposMuestra;
	
	@Override
	protected void doSetClearComponents() {
		clearComponents.add(tbNombre);
		clearComponents.add(cbTipoMuestra);
	}

	@Override
	protected void doSetFieldProperties() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void doSetReadOnlyComponents() throws Exception {
		roComponents.addAll(clearComponents);		
	}

	@Override
	protected void doSetValidation() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void fillBussinesObject() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void fillComboBoxs() throws Exception {
		try
		{
			lmTiposMuestra = new BindingListModelList(new GenericDAO<Type>(UserWorkspace.getInstance().gethSession()).getByBussinessObject(new Type()), true);
		} catch (Exception e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	@Override
	public String getEntityName() {
		return "Metodo";
	}

	@Override
	protected Metodo getNewEntidad() {
		Metodo metodo=new Metodo();
		return metodo;
	}

	@Override
	protected String getRightPreffix() {
		return rightPreffix;
	}

}
